
import java.util.Stack;

/**
 * 作者  Administrator
 * 时间  2017/1/18 11:11
 * 文件  JAVAOOM
 * 描述  栈的使用
 */
public class StackDemo {

	public static void main(String[] args) {
		Object object1=new Object();
		Object object2=new Object();
		Object object3=new Object();
		Object object4=new Object();

		Stack<Object> stack = new Stack<>();
		stack.push(object1);
		stack.push(object2);
		stack.push(object3);
		stack.push(object4);

		finishAllActivity(stack);

	}

	/**
	 * 结束所有Activity
	 * @param activityStack
	 */
	public static void finishAllActivity(Stack<Object> activityStack) {
		for (int i = 0, size = activityStack.size(); i < size; i++) {
			if (null != activityStack.get(i)) {
//				finishActivity(activityStack.get(i));
				System.out.println("index"+i);
			}
		}
		activityStack.clear();
	}




}
